<%inherit file="base.html"/>
<h2>
    ${_('Manage memberships')}
</h2>
<div id="mainPanel">
    <div class="section" id="groups">
        <h3>
            ${_('Memberships')} (${len(group_list['index'])})
            <span class="inlineNav">
                <a href="http://admin.hexlabel.net/create_group/" class="admin">${_('Create group...')}</a>
                <a href="http://my.hexlabel.net/">^ ${_('Back')}</a>
            </span>
        </h3>
        % if errors_groups:
            <div class="alert">${message_groups}</div>
        % elif message_groups:
            <div class="message">${message_groups}</div>
        % endif
        % if len(group_list['index']) > 0:
            <ul class="listForm">
                % for iid in group_list['index']:
                    <li>
                        <form method="post" action="http://admin.hexlabel.net/groups/" class="listForm groupInvitationsForm">
                            <p>
                                <input type="hidden" name="iid" value="${iid}"/>
                            </p>
                            <dl>
                                <dd>
                                    <a href="http://${iid}.hexlabel.net/">
                                        <img src="${group_list['items'][iid]['picture']}" alt="${group_list['items'][iid]['name']}" class="thumbnail"/>
                                    </a>
                                    <div class="itemContent">
                                        <a href="http://${iid}.hexlabel.net/">${group_list['items'][iid]['name']}</a>
                                        % if group_list['items'][iid]['is_member']:
                                            <div class="parentInfo">${_('Group member')}</div>
                                        % endif
                                    </div>
                                </dd>

                                <dd class="buttons">
                                    % if False and group_list['items'][iid]['is_admin']:
                                        <a href="http://admin.hexlabel.net/manage_group/?iid=${iid}" class="button">${_('Manage')}</a>
                                    % endif
                                    % if not group_list['items'][iid]['visibility']:
                                        <div class="roles"><span class="restricted">Friends only</span></div>
                                        <input type="submit" class="submit" name="make_group_public" value="${_('Make Link Public')}"/>
                                    % else:
                                        <input type="submit" class="submit" name="make_group_private" value="${_('Restrict Link to Friends')}"/>
                                    % endif
                                    % if group_list['items'][iid]['is_member']:
                                        <input type="submit" class="submit warn" name="revoke_group" value="${_('Resign')}"/>
                                    % else:
                                        <input type="submit" class="submit warn" name="delete_group_link" value="${_('Remove from list')}"/>
                                    % endif
                                </dd>
                            </dl>
                            <div class="clr"><br/></div>
                        </form>
                    </li>
                % endfor
            </ul>
        % else:
            <ul>
                <li>${_('No memberships. You can click here to <a href="http://admin.hexlabel.net/create_group/">create a group</a>.') |n}</li>
            </ul>
        % endif
    </div>
</div>

<!-- defs -->
<%def name="title()">P2P Fusion - Peerscape | ${profile_fields['generic']['name']['values'][0]['value']} | ${_('Manage memberships')}</%def>
<%def name="body_class()">
    admin self person dialog
</%def>
<%def name="toplinks_style()">
</%def>

